<%@ page import="com.wuchao.service.serviceimpl.ProductImpl" %>
<%@ page import="com.wuchao.entity.Product" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: 吴超
  Date: 2022/4/15
  Time: 15:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <style>
h1,span{
    color: red;
    font-size: 33px;
}div{
    margin: auto;
    width: 400px;
    text-align: center;
 }
    </style>
    <script src="../js/jquery.js"></script>
</head>
<body>

<div>
    <h1>欢迎来到主页面</h1>
    <table border="3">
        <tr>
            <th>编号</th>
            <th>名称</th>
            <th>性别</th>
            <th>状态</th>
            <th>操作</th>
        </tr>
        <% ProductImpl pl=new ProductImpl();
            List<Product> poJo = pl.findPoJo("select * from product");
            for (Product xjj : poJo){
        %>
        <tr>
            <td><%=xjj.getId()%></td>
            <td><%=xjj.getName()%></td>
            <td><%=xjj.getSex()%></td>
            <td><%=(Integer)xjj.getFlage()==0?"上架":"下架"%></td>
            <td>
                <a href="controller.jsp?id=<%=xjj.getId()%>&op=delete"><input type="button" class="delete" value="删除"> </a>
               <%-- <a href="controller.jsp?op=update1&id=<%=xjj.getId()%>&name=<%=xjj.getName()%>&sex=<%=xjj.getSex()%>&falge=<%=xjj.getFlage()%>">修改</a>--%>
                <a href="controller.jsp?op=update1&id=<%=xjj.getId()%>">修改</a>
            </td>
        </tr>
        <% }%>
    </table>
    <a href="add.jsp">增加</a>
    <span><%=request.getParameter("isdelete1")==null?"":"删除成功"%> </span>
    <span><%=request.getParameter("isdelete2")==null?"":"删除失败"%> </span>
    <span><%=request.getParameter("isadd1")==null?"":"增加成功"%> </span>
    <span><%=request.getParameter("isadd2")==null?"":"增加失败"%> </span>
    <span><%=request.getParameter("isupdate1")==null?"":"修改成功"%> </span>
    <span><%=request.getParameter("isupdate2")==null?"":"修改失败"%> </span>
</div>

<script>
$(".delete").click(function () {
    if(confirm("确定删除吗？")){
        return true;
    }else{
        return  false;
    }
});
$("table tr:odd").css("background-color","yellow");
</script>
</body>
</html>
